﻿using System;
using System.Collections.Generic;
using WAD.WEB.AppCode;
using System.Text;
using WAD.Model;
using WAD.DAL;
namespace WAD.WEB.Admin.Ajax
{

    public class FC_Shared : AdminAjax
    {
        public override void AjaxMethodDispatch(String identity)
        {
            switch (identity)
            {
                case "getdetaillist": this.GetDetailList(); break;
                case "changeispass": this.ChangeIsPass(); break;
            }
        }
        /// <summary>
        /// 红包截图列表(列出指定一条文章的所有截图)
        /// </summary>
        [QD.Web.Ajax.AjaxMethod]
        public void GetDetailList()
        {
            int id = Parse.Int("id", 0);
            string is_pass = Parse.String("is_pass");
            if (id == 0)
            {
                ParamError();
            }
            if (string.IsNullOrEmpty(is_pass))
                is_pass = "0";
            Success(DAOFCShared.GetListAllByArticleId(id, QD.WX.Utill.Util.FilterSql(is_pass)));
        }
        /// <summary>
        /// 修改通过状态
        /// </summary>
        [QD.Web.Ajax.AjaxMethod]
        public void ChangeIsPass()
        {
            int id = Parse.Int("id", 0);
            int isPass = Parse.Int("is_pass", -1);

            if (id == 0 || isPass == -1)
            {
                ParamError();
            }

            if (DAOFCShared.changeIsPass(id, isPass))
            {
                if (isPass == 2)
                    DAOLog.Add("朋友圈图片拒绝[id:" + id + "]", adminId, 0);
                Success();
            }
            else
            {
                Fail();
            }
        }
    }
}